/* 
 *  Copyright (C) 2006 James Young
 * `gurumind(a)gmail.com
 * 
 */

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace IPDEditor
{
    /// <summary>
    /// field 4,5: special case: 0xFFFFFFFF, 0x00000001, smart case: 0x00000000, 00000000
    /// </summary>
    public class IPDUIAutoText : IPDVisualRecord
    {
        public IPDUIAutoText(IPDDatabase IpdDatabase) : base(IpdDatabase)
        {
            
        }

        public override void FillData(IPDItem IpdItem)
        {
            
        }

        protected override string Field2String(IPDField field)
        {
            return EncUtil.AutoBin2String(field.data);
            //return base.Field2String(field);
        }

        protected override bool UpdateFieldAsMixString(IPDField fld, string inputText)
        {
            return base.UpdateFieldAsMixString(fld, inputText, Encoding.BigEndianUnicode);
        }

        public override string ToString()
        {
            return string.Format("{2} \r {0} -> \"{1}\"", EncUtil.AutoBin2String(_ipdItem.Items[0].data), EncUtil.AutoBin2String(_ipdItem.Items[1].data), base.ToString());
        }

        public override string ToShortString()
        {
            return EncUtil.AutoBin2String(_ipdItem.Items[0].data);
        }
    }
}
